package item.inkcloud.gateway.utils;


import com.alibaba.fastjson.JSONObject;

import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;

import javax.xml.crypto.Data;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;

@Component
public class ResponeUtils {


    public DataBuffer getResponeBuffer( ServerHttpResponse response){



        JSONObject jsonObject = new JSONObject();
        jsonObject.put("status",-1);

        byte[] bits = jsonObject.toJSONString().getBytes(StandardCharsets.UTF_8);

        DataBuffer buffer = response.bufferFactory().wrap(bits);

        return buffer ;


    }

}
